#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/sem.h>

#define U1 unsigned char
#define U4 unsigned int
#define TSHM_SIZE 10240
#define TSHM_1BYTE_SIZE 10 

#ifndef TSHM_KEY
#define TSHM_KEY 2222
#endif

#ifndef TSHM_SEM_KEY
#define TSHM_SEM_KEY 2222
#endif

enum{TSHM_CHAR1=0,TSHM_CHAR2};

struct tshm_1byte_item{
	U4 id;
	U1 *name;
	U1 value;
};

struct tshm_data{
	struct tshm_1byte_item u1[TSHM_1BYTE_SIZE];
};

typedef union tshm{
	U1 block[TSHM_SIZE];
	struct tshm_data d;
}TSHM_T;

void Tshm_sem_init(int key);
int Tshm_sem_p(void);
int Tshm_sem_v(void);
